<!doctype html>
<html lang="zh">
  <head>
    <meta charset="UTF-8" />
    <!-- <link rel="icon" href="/favicon.svg" /> -->
    <link
      rel="stylesheet"
      media="screen and (min-width: 1025px)"
      href="/src/styles/responsive/pc.scss"
    />
    <link
      rel="stylesheet"
      media="screen and (min-width: 768px) and  (max-width: 1024px)"
      href="/src/styles/responsive/ipad.scss"
    />
    <link
      rel="stylesheet"
      media="screen and (max-width: 767px)"
      href="/src/styles/responsive/mobile.scss"
    />
    <meta
      name="viewport"
      content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0"
    />
    <title><%= title %></title>
  </head>

  <body>
    <div id="app">
      <style>
        body {
          overflow: hidden;
          margin: 0;
        }

        .app-loading-mask {
          display: flex;
          width: 100vw;
          height: 100vh;
          justify-content: center;
          align-items: center;
          flex-direction: column;
          background-color: #f4f7f9;
        }

        .app-loading-spinner .circular {
          width: 42px;
          height: 42px;
          animation: loading-rotate 2s linear infinite;
        }

        .app-loading-spinner .path {
          animation: loading-dash 1.5s ease-in-out infinite;
          stroke-dasharray: 90, 150;
          stroke-dashoffset: 0;
          stroke-width: 2;
          stroke: #409eff;
          stroke-linecap: round;
        }

        .app-loading-logo {
          width: 44px;
        }

        .app-loading-text {
          display: flex;
          margin-top: 30px;
          font-size: 16px;
          color: rgb(0 0 0 / 85%);
          justify-content: center;
          align-items: center;
        }

        @keyframes loading-rotate {
          100% {
            transform: rotate(360deg);
          }
        }

        @keyframes loading-dash {
          0% {
            stroke-dasharray: 1, 200;
            stroke-dashoffset: 0;
          }

          50% {
            stroke-dasharray: 90, 150;
            stroke-dashoffset: -40px;
          }

          100% {
            stroke-dasharray: 90, 150;
            stroke-dashoffset: -120px;
          }
        }
      </style>
      <div class="app-loading-mask">
        <!-- <img src="/favicon.svg" class="app-loading-logo" alt="Logo" /> -->
        <div class="app-loading-spinner">
          <svg class="circular" viewBox="0 0 50 50">
            <circle class="path" cx="25" cy="25" r="20" fill="none"></circle>
          </svg>
        </div>
        <div class="app-loading-text">加载中...</div>
      </div>
    </div>
    <script>
      window.onload = function () {
        // 阻止双击放大
        var lastTouchEnd = 0
        document.addEventListener('touchstart', function (event) {
          if (event.touches.length > 1) {
            event.preventDefault()
          }
        })
        document.addEventListener(
          'touchend',
          function (event) {
            var now = new Date().getTime()
            if (now - lastTouchEnd <= 300) {
              event.preventDefault()
            }
            lastTouchEnd = now
          },
          false
        )

        // 阻止双指放大
        document.addEventListener('gesturestart', function (event) {
          event.preventDefault()
        })
      }

      // //改变font-size
      // (function (doc, win) {
      //   var docEI = doc.documentElement,
      //     resizeEvt = 'orientationchange' in window ? 'orientataionchange' : 'resize',
      //     recalc = function () {
      //       var clientWidth = docEI.clientWidth;
      //       if (!clientWidth) return;
      //       //100是字体大小，1536是开发时浏览器窗口的宽度，等比计算
      //       docEI.style.fontSize = 100 * (clientWidth / 1536) + 'px';
      //     }

      //   if (!doc.addEventListener) return;
      //   win.addEventListener(resizeEvt, recalc, false);
      //   doc.addEventListener('DOMContentLoaded', recalc, false);
      // })(document, window);
      const favicon = document.createElement('link')
      favicon.rel = 'icon'
      favicon.href = localStorage.getItem('logo')
      console.log('favicon.href: ', favicon.href)
      document.querySelector('head')?.appendChild(favicon)
    </script>
    <script type="module" src="/src/main.ts"></script>
  </body>
</html>
